﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true"
    CodeBehind="OrderDebt.aspx.cs" Inherits="KCL.Management.OrderDebt" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 125px;
        }
        .style2
        {
            width: 300px;
        }
        .style3
        {
        }
    </style>
    <link href="../styles/css/style.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:SqlDataSource ID="srcOrder" runat="server" ConnectionString="<%$ ConnectionStrings:KCLConnectionString %>"
                SelectCommand="SELECT Code FROM [Order] ORDER BY Code"></asp:SqlDataSource>
            <asp:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy" TargetControlID="txtPayDate"
                PopupButtonID="imgbtnPayDate">
            </asp:CalendarExtender>
            <div class="boxed">
            <h2 class="title" style="text-align: left; font-weight: bold; padding-left: 20px;
                    padding-top: 10px; height: 30px">
                    Công nợ khách hàng
                </h2>
            <table style="width: 955px;" cellpadding="5">
                <tr>
                    <td class="style1">
                        Số đơn hàng
                    </td>
                    <td class="style2">
                        <asp:ComboBox ID="cboOrderCode" runat="server" Width="150px" AutoCompleteMode="SuggestAppend"
                            DataSourceID="srcOrder" DataTextField="Code" DataValueField="Code" DropDownStyle="DropDownList">
                        </asp:ComboBox>
                    </td>
                    <td class="style3">
                        Đợt thanh toán
                    </td>
                    <td>
                        <asp:TextBox ID="txtPayTurn" runat="server" Width="150px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        Số tiền thanh toán
                    </td>
                    <td class="style2">
                        <asp:TextBox ID="txtPayAmount" runat="server" Width="150px"></asp:TextBox>
                    </td>
                    <td class="style3">
                        Ngày thanh toán
                    </td>
                    <td>
                        <asp:TextBox ID="txtPayDate" runat="server" Width="150px"></asp:TextBox>
                        <asp:ImageButton ID="imgbtnPayDate" runat="server" ImageUrl="~/styles/images/calendar_icon.gif" />
                    </td>
                </tr>
                <tr>
                    <td class="style1">
                        &nbsp;
                    </td>
                    <td class="style2">
                        <asp:Button ID="btnAddOrderDebt" runat="server" Height="30px" Text="Thêm công nợ"
                            Width="120px" OnClick="btnAddOrderDebt_Click" />
                        &nbsp;<asp:Button ID="btnUpdateOrderDebt" runat="server" Height="30px" Text="Chỉnh Sửa"
                            Width="120px" OnClick="btnUpdateOrderDebt_Click" />
                    </td>
                    <td class="style3" colspan="2">
                        <asp:Label ID="lblMessage" runat="server" Font-Italic="True"></asp:Label>
                    </td>
                </tr>
            </table>
            </div>
            <div class="boxed">
            <h2 class="title" style="text-align: left; font-weight: bold; padding-left: 20px;
                    padding-top: 10px; height: 30px">
                    Danh sách công nợ
                </h2>
            <asp:GridView ID="dgvOrderDebt" runat="server" AutoGenerateColumns="False" BackColor="White"
                BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="srcOrderDebt"
                EnableModelValidation="True" ForeColor="Black" GridLines="Vertical" Width="950px"
                AllowPaging="True" DataKeyNames="orderCode,payTurn" OnSelectedIndexChanged="dgvOrderDebt_SelectedIndexChanged"
                PageSize="20">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                    <asp:BoundField DataField="CustomerCode" HeaderText="Mã khách hàng" SortExpression="CustomerCode" />
                    <asp:BoundField DataField="CustomerName" HeaderText="Tên khách hàng" SortExpression="CustomerName" />
                    <asp:BoundField DataField="OrderCode" HeaderText="Số đơn hàng" SortExpression="OrderCode" />
                    <asp:BoundField DataField="PayTurn" HeaderText="Đợt thanh toán" SortExpression="PayTurn" />
                    <asp:BoundField DataField="PayDate" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Ngày thanh toán"
                        SortExpression="PayDate" />
                    <asp:BoundField DataField="PayAmount" HeaderText="Số tiền" SortExpression="PayAmount"
                        ItemStyle-HorizontalAlign="Right">
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="TotalPrice" HeaderText="Tổng tiền" SortExpression="TotalPrice"
                        ItemStyle-HorizontalAlign="Right">
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="Remain" HeaderText="Còn lại" SortExpression="Remain" ItemStyle-HorizontalAlign="Right">
                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton Style="color: Black" ID="LinkButton1" runat="server" CausesValidation="False"
                                CommandName="Delete" Text="Xóa" OnClientClick="javascript:return confirm('Bạn có chắc muốn xóa dòng này?');"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <HeaderStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="#CC0000" />
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <RowStyle BackColor="#F7F7DE" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            </div>
            <asp:ObjectDataSource ID="srcOrderDebt" runat="server" SelectMethod="GetOrderDebtViews"
                TypeName="KCL.Code.Business.OrderDebtServices" DataObjectTypeName="KCL.Code.OrderDebt"
                DeleteMethod="Delete"></asp:ObjectDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
